import SecondLayout from '~/layout/SecondLayout';
import BasicInformationRouter, {ENTERPRISE_DETAILS} from './second-level-router/BasicInfomationRouter';
import {LAWS_REGULATIONS} from "~/router/second-level-router/SecurityManagementRouter/ManagementBasisRouter";

import SecurityManagementRouter from './second-level-router/SecurityManagementRouter'

import MonitorControlRouter, {ONLINE_MONITORING} from './second-level-router/MonitorControlRouter'

import WarningManagementRouter from './second-level-router/WarningManagementRouter';
import {SURFACE_DISPLACEMENT_DW} from "~/router/second-level-router/WarningManagementRouter/DataWarningRouter";

import SafetyTechnologyRouter, {FLOOD_CALCULUS} from "./second-level-router/SafetyTechnologyRouter";

import AnalysisReportRouter, {DAILYREPORT} from './second-level-router/AnalysisReportRouter';

import SystemManagementRouter, {TAILING_POND_INFOR} from './second-level-router/SystemManagementRouter';
import Notfound from "../views/Notfound";
import {printRouter} from "~/Contants";
import DevUtils from "~/utils/DevUtils";

export const BASIC_INFORMATION = 'basic-information';
export const SECURITY_MANAGEMENT = 'security-management';
export const MONITORING = 'monitoring';
export const WARNING_MANAGEMENT = 'warning-management';
export const SAFETY_TECHNOLOGY = 'safety-technology';
export const ANALYSIS_REPORT = 'analysis-report';
export const SYSTEM_MANAGEMENT = 'system-management';
export const NOT_FOUND = "404";

const routers = [{
        path: BASIC_INFORMATION,
        name: BASIC_INFORMATION,
        component: SecondLayout,
        meta: {
            label: "基础信息",
            icon: "icon-w-list",
            hasSecond: true,
        },
        redirect: {
            name: ENTERPRISE_DETAILS
        },
        children: BasicInformationRouter,
    },
    {
        path: SECURITY_MANAGEMENT,
        name: SECURITY_MANAGEMENT,
        component: SecondLayout,
        meta: {
            label: "安全管理",
            icon: "icon-w-shield",
            hasSecond: true,
        },
        children: SecurityManagementRouter,
        redirect: {
            name: LAWS_REGULATIONS
        },
    },
    {
        path: MONITORING,
        name: MONITORING,
        component: SecondLayout,
        meta: {
            label: "监测监控",
            icon: "icon-w-screen",
            hasSecond: true,
        },
        children: MonitorControlRouter,
        redirect: {
            name: ONLINE_MONITORING
        },
    },
    {
        path: WARNING_MANAGEMENT,
        name: WARNING_MANAGEMENT,
        component: SecondLayout,
        children: WarningManagementRouter,
        redirect: {
            name: SURFACE_DISPLACEMENT_DW
        },
        meta: {
            label: "预警管理",
            icon: "icon-w-warning",
            hasSecond: true,
        },
    },
    {
        path: SAFETY_TECHNOLOGY,
        name: SAFETY_TECHNOLOGY,
        component: SecondLayout,
        meta: {
            label: "安全技术",
            icon: "icon-w-technology",
            hasSecond: true,
        },
        children: SafetyTechnologyRouter,
        redirect: {
            name: FLOOD_CALCULUS
        },
    },
    {
        path: ANALYSIS_REPORT,
        name: ANALYSIS_REPORT,
        component: SecondLayout,
        meta: {
            label: "安全现状分析",
            icon: "icon-w-note",
            hasSecond: true,
        },
        children: AnalysisReportRouter,
        redirect: {
            name: DAILYREPORT
        },
    },
    {
        path: SYSTEM_MANAGEMENT,
        name: SYSTEM_MANAGEMENT,
        component: SecondLayout,
        meta: {
            label: "系统管理",
            icon: "icon-w-config",
            hasSecond: true,
        },
        redirect: {
            name: TAILING_POND_INFOR
        },
        children: SystemManagementRouter,
    },
    {
        path: NOT_FOUND,
        name: NOT_FOUND,
        component: Notfound,
    },
    {
        path: "*",
        name: "_404",
        redirect: {name: NOT_FOUND}
    },
];

try {
    if(printRouter){
        console.log('将使用以下格式化器生成路由表：', DevUtils);
        DevUtils.exportRouterSql(routers);
    }
}catch (e) {
    console.error(e);
}

export default routers;
